import { Box, Typography } from '@mui/material';
import React from 'react';
import { useLocation } from 'react-router-dom';

const Algorithms: React.FC = () => {
  const location = useLocation();

  const getContent = () => {
    const path = location.pathname.split('/')[2];
    switch (path) {
      case 'sorting':
        return (
          <Box>
            <Typography variant="h4" gutterBottom>
              排序算法
            </Typography>
            <Typography variant="body1">
              排序算法是一种能将一系列数据按照特定顺序排列的算法。
            </Typography>
          </Box>
        );
      default:
        return <Typography variant="body1">请从右侧菜单选择要学习的算法。</Typography>;
    }
  };

  return <Box sx={{ maxWidth: '800px', margin: '0 auto' }}>{getContent()}</Box>;
};

export default Algorithms;
